﻿//using System;
//using System.Collections.Generic;
//using System.Data;
//using System.Data.Entity;
//using System.Linq;
//using System.Linq.Expressions;
//using System.Web;
//using Domain;

//namespace Persistent
//{
//    public interface IGamePlayerRepository : IDisposable
//    {
//        IQueryable<GamePlayer> All { get; }
//        GamePlayer Find(int id);
//        void InsertOrUpdate(GamePlayer player);
//        void Delete(int id);
//        void Save();
//    }

//    // This can be improved more with using One generic implementation using base classes and .Net generics

//    public class GamePlayerRepository : BaseRepository, IGamePlayerRepository
//    {
//        public IQueryable<GamePlayer> All
//        {
//            get { return context.GamePlayers; }
//        }
                
//        public GamePlayer Find(int id)
//        {
//            return context.GamePlayers.Find(id);
//        }

//        public void InsertOrUpdate(GamePlayer gamePlayer)
//        {
//            if (gamePlayer.GamePlayerId == default(int)) 
//            {
//                context.GamePlayers.Add(gamePlayer);
//            } 
//            else
//            {
//                context.Entry(gamePlayer).State = EntityState.Modified;
//            }
//        }

//        public void Delete(int id)
//        {
//            var gamePlayer = context.GamePlayers.Find(id);
//            context.GamePlayers.Remove(gamePlayer);
//        }
        
//    }

//}
